package com.macro.mall.model;

import cn.hutool.json.JSONObject;
import com.macro.mall.common.api.PageReq;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * ums_community实体类
 *
 * @author gaodx
 *
 */
@Data
@ApiModel("ums_community社区信息实体类")
public class UmsCommunity extends PageReq implements Serializable{
	/**主键*/
    @ApiModelProperty(value = "主键")
	private Long id; 
	/**社区名称*/
    @ApiModelProperty(value = "社区名称")
	private String communityName; 
	/**社区图片*/
    @ApiModelProperty(value = "社区图片")
	private String communityPic; 
	/**社区描述*/
    @ApiModelProperty(value = "社区描述")
	private String communityDesc; 
	/**状态*/
    @ApiModelProperty(value = "状态 0不可用 1可用")
	private Integer status; 
	/**社区管理员*/
    @ApiModelProperty(value = "社区管理员")
	private String leader; 
	/**电话*/
    @ApiModelProperty(value = "电话")
	private String phone; 
	/**邮件*/
    @ApiModelProperty(value = "邮件")
	private String email; 
	/**城市编码*/
    @ApiModelProperty(value = "省份编码")
	private String province;
	/**城市编码*/
    @ApiModelProperty(value = "城市编码")
	private String cityCode;
	/**区县编码*/
    @ApiModelProperty(value = "区县编码")
	private String countyCode;
	/**街道*/
    @ApiModelProperty(value = "街道")
	private String street;
	/**详细地址*/
    @ApiModelProperty(value = "详细地址")
	private String address;
	/**经度*/
    @ApiModelProperty(value = "经度")
	private Double longitude; 
	/**纬度*/
    @ApiModelProperty(value = "纬度")
	private Double latitude;
	/**面积*/
    @ApiModelProperty(value = "面积")
	private Double area;
	/**人口*/
    @ApiModelProperty(value = "人口")
	private Long population;
	/**合作开始时间*/
    @ApiModelProperty(value = "合作开始时间")
	private Date startTime;
	/**合作结束时间*/
    @ApiModelProperty(value = "合作结束时间")
	private Date endTime;
	/**创建时间*/
    @ApiModelProperty(value = "创建时间")
	private Date createTime;


	/**
	 * 实例化
	 */
	public UmsCommunity() {
		super();
	}
	/**
	 * 实例化
	 * 
	 * @param obj
	 */

	public UmsCommunity(JSONObject obj) {
		this();
		if (obj.get("id") instanceof Number) {
			this.setId(((Number) obj.get("id")).longValue());
		}
		if (obj.get("communityName") instanceof String) {
			this.setCommunityName((String) obj.get("communityName"));
		}
		if (obj.get("communityPic") instanceof String) {
			this.setCommunityPic((String) obj.get("communityPic"));
		}
		if (obj.get("communityDesc") instanceof String) {
			this.setCommunityDesc((String) obj.get("communityDesc"));
		}
		if (obj.get("status") instanceof Number) {
			this.setStatus(((Number) obj.get("status")).intValue());
		}
		if (obj.get("leader") instanceof String) {
			this.setLeader((String) obj.get("leader"));
		}
		if (obj.get("phone") instanceof String) {
			this.setPhone((String) obj.get("phone"));
		}
		if (obj.get("email") instanceof String) {
			this.setEmail((String) obj.get("email"));
		}
		if (obj.get("cityCode") instanceof String) {
			this.setCityCode((String) obj.get("cityCode"));
		}
		if (obj.get("countyCode") instanceof String) {
			this.setCountyCode((String) obj.get("countyCode"));
		}
		if (obj.get("address") instanceof String) {
			this.setAddress((String) obj.get("address"));
		}
		if (obj.get("longitude") instanceof Number) {
			this.setLongitude(((Number) obj.get("longitude")).doubleValue());
		}
		if (obj.get("latitude") instanceof Number) {
			this.setLatitude(((Number) obj.get("latitude")).doubleValue());
		}
		if (obj.get("area") instanceof Number) {
			this.setArea(((Number) obj.get("area")).doubleValue());
		}
		if (obj.get("population") instanceof Number) {
			this.setPopulation(((Number) obj.get("population")).longValue());
		}
	}
	
	/**
	 * 将当前对象转换为JsonObject
	 * 
	 * @return
	 */
	public JSONObject toJson() {
		JSONObject result = new JSONObject();
		if (this.getId() != null) {
			result.put("id",this.getId());
		}
		if (this.getCommunityName() != null) {
			result.put("communityName",this.getCommunityName());
		}
		if (this.getCommunityPic() != null) {
			result.put("communityPic",this.getCommunityPic());
		}
		if (this.getCommunityDesc() != null) {
			result.put("communityDesc",this.getCommunityDesc());
		}
		if (this.getStatus() != null) {
			result.put("status",this.getStatus());
		}
		if (this.getLeader() != null) {
			result.put("leader",this.getLeader());
		}
		if (this.getPhone() != null) {
			result.put("phone",this.getPhone());
		}
		if (this.getEmail() != null) {
			result.put("email",this.getEmail());
		}
		if (this.getCityCode() != null) {
			result.put("cityCode",this.getCityCode());
		}
		if (this.getCountyCode() != null) {
			result.put("countyCode",this.getCountyCode());
		}
		if (this.getAddress() != null) {
			result.put("address",this.getAddress());
		}
		if (this.getLongitude() != null) {
			result.put("longitude",this.getLongitude());
		}
		if (this.getLatitude() != null) {
			result.put("latitude",this.getLatitude());
		}
		if (this.getArea() != null) {
			result.put("area",this.getArea());
		}
		if (this.getPopulation() != null) {
			result.put("population",this.getPopulation());
		}
		return result;
	}


	@Override
	public String toString() {
		return "UmsCommunity [id=" + id + " , communityName=" + communityName + " , communityPic=" + communityPic + " , communityDesc=" + communityDesc + " , status=" + status + " , leader=" + leader + " , phone=" + phone + " , email=" + email + " , cityCode=" + cityCode + " , countyCode=" + countyCode + " , address=" + address + " , longitude=" + longitude + " , latitude=" + latitude + " , area=" + area + " , population=" + population + "  ]";
	
	}
	
	
}
